<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script type="module">
        import BinarySearchTree from './BinarySearchTree.js';

        const tree = new BinarySearchTree();
        tree.insert(11);
        tree.insert(7);
        tree.insert(15);
        tree.insert(5);
        tree.insert(3);
        tree.insert(9);
        tree.insert(8);
        tree.insert(10);
        tree.insert(13);
        tree.insert(12);
        tree.insert(14);
        tree.insert(20);
        tree.insert(18);
        tree.insert(25);
        console.log(tree);

        tree.insert(6);
        const printNode = (value) => console.log(value);
        // tree.inOrderTraverse(printNode);
        // tree.preOrderTraverse(printNode);
        tree.postOrderTraverse(printNode);

        console.log(tree.max());
        console.log(tree.min());

        console.log(tree.search(1) ? 'Key 1 found.' : 'Key 1 not found.');
        console.log(tree.search(8) ? 'Key 8 found.' : 'Key 8 not found.');

        tree.remove(6);
        tree.remove(5);
        tree.remove(18);
        tree.postOrderTraverse(printNode);
    </script>
</body>
</html>